<template>
    <div>
        <h3>排房页面</h3>
        <table class="table">
            <tr>
                <td><input type="button" value="标准间" @click="Find(1)">&emsp;<input type="button" value="豪华间" @click="Find(2)">&emsp;<input type="button" value="双人间" @click="Find(3)">&emsp;<input type="button" value="儿童间" @click="Find(4)"></td>
            </tr>
            <h4>房型信息</h4>
            <tr>
                <td>房型:&emsp;{{data.houseName}}</td>
            </tr>
            <tr>
                <td>未排:0</td>
            </tr>
               <tr>
                <td>
                   
                    已排:&emsp; <input type="text" v-model="info.typeName" disabled></td>
            </tr>
            <h4>选择房号</h4>
            <tr>
                <td> <input type="button" value="102" @click="Findtwo(1)">&emsp;
                    <input type="button" value="103" @click="Findtwo(2)">&emsp;
                    <input type="button" value="104" @click="Findtwo(3)">
                </td>
            </tr>
            <tr>
                <td></td>
                <td><input type="button" value="确定" @click="UPdate"></td>
            </tr>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios'
import {ref,reactive,onMounted} from 'vue'
import { useRoute,useRouter } from 'vue-router';
const router = useRouter();
const route = useRoute();
const data:any=reactive({
    typeId:'',
    houseName:''
})
const info:any=reactive({
    typeId:'',
    typeName:''
})
const Findtwo=(id:any)=>{
    axios.get('https://localhost:7267/api/Boss/TypeOrange',{params:{id:id}}).then(res=>{
    Object.assign(info,res.data);
    })
}
const Find=(id:any)=>{
    axios.get('https://localhost:7267/api/Boss/GetHouseType',{params:{id:id}}).then(res=>{
        Object.assign(data,res.data);
    })
}
const UPdate=()=>{
    axios.put('https://localhost:7267/api/Boss/UPdate',data).then(res=>{
        if(res.data>0)
    {
        alert('排布成功');
    }
    else
    {
        alert('排布失败');
    }
    })
}
</script>

<style scoped>

</style>